Skip to content

Commit e1692b7

Browse files
oberparhoeppnerj
authored andcommitted
chpstat: Fix scaling of DPU utilization calculation
chpstat incorrectly reports DPU utilization as fraction instead of percent. Fix this by scaling utilization values to 100%. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com> Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
1 parent 54b3c9e commit e1692b7

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

zconf/chp/chpstat/cmg4.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,17 @@ static void calc_ext_metrics(struct cmg_data_t *data, u32 ticks)
281281
if (cmcb->dpu_num_cores == 0)
282282
return;
283283

284-
/* dpu_util = dpu_exec_time_cpc / (t * dpu_num_cores) */
284+
/* dpu_util = 100 * dpu_exec_time_cpc / (t * dpu_num_cores) */
285285
delta = field_delta(dpu_exec_time_cpc, ext_a, ext_b);
286-
m->dpu_util = delta / ((double)ticks * cmcb->dpu_num_cores);
286+
m->dpu_util = 100.0 * delta / ((double)ticks * cmcb->dpu_num_cores);
287287

288-
/* dpu_util_total = dpu_channel_exec_time_cpc / (t * dpu_num_cores) */
288+
/*
289+
* dpu_util_total = 100 * dpu_channel_exec_time_cpc /
290+
* (t * dpu_num_cores)
291+
*/
289292
delta = field_delta(dpu_channel_exec_time_cpc, ext_a, ext_b);
290-
m->dpu_util_total = delta / ((double)ticks * cmcb->dpu_num_cores);
293+
m->dpu_util_total = 100.0 * delta /
294+
((double)ticks * cmcb->dpu_num_cores);
291295

292296
/* dpu_util_part = dpu_util_total * channel_work_units /
293297
* channel_work_units_cpc */

zconf/chp/chpstat/cmg5.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,17 @@ static void calc_ext_metrics(struct cmg_data_t *data, double seconds, u32 ticks)
350350
if (cmcb->dpu_num_cores == 0)
351351
return;
352352

353-
/* dpu_util = dpu_exec_time_cpc / (t * dpu_num_cores) */
353+
/* dpu_util = 100 * dpu_exec_time_cpc / (t * dpu_num_cores) */
354354
delta = field_delta(dpu_exec_time_cpc, ext_a, ext_b);
355-
m->dpu_util = delta / ((double)ticks * cmcb->dpu_num_cores);
355+
m->dpu_util = 100.0 * delta / ((double)ticks * cmcb->dpu_num_cores);
356356

357-
/* dpu_util_total = dpu_channel_exec_time_cpc / (t * dpu_num_cores) */
357+
/*
358+
* dpu_util_total = 100 * dpu_channel_exec_time_cpc /
359+
* (t * dpu_num_cores)
360+
*/
358361
delta = field_delta(dpu_channel_exec_time_cpc, ext_a, ext_b);
359-
m->dpu_util_total = delta / ((double)ticks * cmcb->dpu_num_cores);
362+
m->dpu_util_total = 100.0 * delta /
363+
((double)ticks * cmcb->dpu_num_cores);
360364

361365
/* dpu_util_part = dpu_util_total * channel_work_units /
362366
* channel_work_units_cpc */

0 commit comments

Comments
 (0)